<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width,user-scalable=0"/>

		<meta charset="UTF-8">
		<title>BD健身</title>
		<script src="__api__/js/fontSize.js"></script>
		<link rel="stylesheet" href="__api__/css/bootstrap.min.css">
		<link rel="stylesheet" href="__api__/css/reset.css"/>
		<link rel="stylesheet" href="__api__/font-awesome/css/font-awesome.css">
		<link rel="stylesheet" href="__api__/css/my_main.css"/>
		<link rel="stylesheet" href="__api__/css/jquery-weui.min.css"/>
		<link rel="stylesheet" href="__api__/css/weui.min.css"/>
		<script src="__api__/js/lrzLib.js"></script>
	
		<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
        <script src="__api__/js/details2.js"></script>
		<!--<link rel="stylesheet" href="css/style.css">-->

	</head>
	  
<body>
<!--页头-->

<!--banner_begin-->
<div id="carousel-example-generic" class="carousel slide both" data-ride="carousel">


	<div class="carousel-inner" role="listbox">
	<input type="hidden" id="gym" value="{$res.id}">
		<div class="item active">
			<img src="__uploads__{$res.pic[0]['pic']}">
		</div>
		{volist name="res.pic" id="data"}
		<div class="item">
			<img src="__uploads__{$data.pic}">
		</div>
		{/volist}
		
	</div>
	<!-- Controls -->
	<a id="carleft" class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">

	</a>
	<a id="carright" class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">

	</a>
</div>
<div class="detail">
	<div class="container">
		<div class="detail_box1">
			<div class="det_title">
				<h3>{$res.designation}</h3>
				<div class="praise">
					<span id="praise">
					{empty name="res.fa"}
<img src="__api__/images/zan.png" id="praise-img" />
{/empty}
{notempty name="res.fa"}
<img src="__api__/images/yizan.png" id="praise-img" />
{/notempty}

</span>
		
				</div>
			</div>
			<div class="det_cont">
				<p class="pull-left">{$res.address}</p>
				<a href="{:url('api/Map/daohang')}?d_address={$res.address}&o_lat={$res.location['o_lat']}&o_lng={$res.location['o_lng']}"><img src="__api__/images/zb.png" class="pull-right"></a>
			</div>
			<div class="detail_other">
				<div class="detail_item">
					<span>
					{if condition="$res.wifi==1"}wifi
{else /}
不提供wifi
{/if}

					
					</span>
				</div>
				<div class="detail_item" style="margin-left: 0.18rem;">
					<span>{$res.business_hours}</span>
				</div>

			</div>
		</div>
		<div class="detail_box2">
			<div class="detail_eval">
				<div class="detEval pull-left">
					<img src="__api__/images/star.png">
					<p><a href="{:url('api/Venue/Evation')}?id={$res.id}">评价<span>{$res.eva}</span></a></p>
				</div>
				<div class="detail_tel pull-right" data-toggle="modal" data-target="#myModal">
					<img src="__api__/images/tel.png">
				</div>
			</div>

			<!--电话提示框-->

			<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h4 class="modal-title" id="myModalLabel">确认拨打{$res.telphone}</h4>
						</div>
						<div class="modal-body">
							联系店长
						</div>
						<div class="modal-footer">
							<a href="javascript:" class="btn btn-default" data-dismiss="modal">取消</a>
							<a href="javascript:" class="btn btn-primary">确定</a>
						</div>
					</div>
				</div>
			</div>

		</div>
		<div id="detail_box3">
			<div class="detBox3_tit">
				<h3>场馆介绍</h3>
			</div>
			<div class="detBox3_cont">
				<div class="stat">
					<div class="stat_name">
						<span>场馆面积</span>
					</div>
					<p>{$res.introduce['area']}m</p>
				</div>
				<div class="stat">
					<div class="stat_name">
						<span>提供器械</span>
					</div>
					<p>{$res.introduce['qixie']}</p>
				</div>
				<div class="stat">
					<div class="stat_name">
						<span>可选课程</span>
					</div>
					<p>{$res.introduce['course']}</p>
				</div>
			</div>
		</div>
			<!-- angular app -->
		<div ng-app="myApp" class="detail_box4">
			<div class="detBox4_tit">
				<h4 class="pull-left">场地位</h4>
				<a href="javascript:" class="pull-right open-popup" data-target="#rule">预约规则</a>
			</div>
			<div class="find_nav">
				<div class="find_nav_left">
					<div ng-controller="dateCtrl" class="find_nav_list">
						<ul id="pagenavi1" >
							<li class="find_nav_cur" ng-repeat="x in dateArr">
								<a href="#" ng-click="selectD()">
									<p>{{x.week}}</p>
									<p>{{x.day}}</p>
								</a>
							</li>
							<li class="sideline"></li>
						</ul>
					</div>
				</div>
			</div>
			<div id="slider1" class="swipe2">

				<ul class="box01_list">
					<li class="li_list" style="height:6rem;">
						<div class="detail_table">
							<!-- 表格 start -->
							<div  ng-controller="myCtrl">
								<table class="table table-bordered" ng-model="data">
									<tr ng-repeat="obj in data">
										<td ng-repeat="item in obj">
											<p class="det_time">{{item.time}}:00~{{item.time + 1}}:00</p>
											<a href="##" ng-click="selectQ(item)" ng-style="qstyle">器械<span>{{item.qixi.use}}</span>/<span>{{item.qixi.total}}</span></a>
											<a href="##" ng-click="selectC(item)" ng-style="cstyle">课程<span>{{item.course.use}}</span>/<span>{{item.course.total}}</span></a>
										</td>
									</tr>
								</table>
							</div>
							<!-- 表格 end -->
						</div>
					</li>
				</ul>
			</div>
		</div>

		<div style="color:#ffffff">g</div>

		<div class="detail_btn">
			<a id="go" href="javascript:">确定选择</a>
		</div>
	</div>

</div>
<div id="rule" class="weui-popup__container">
	<div class="weui-popup__overlay"></div>
	<div class="weui-popup__modal">
		<a href="javascript:" class='close-popup'>关闭</a>
		<div class="rule_cont">

		</div>
	</div>
</div>
								




<script src="__api__/js/jquery-3.2.1.min.js"></script>
<script src="__api__/js/bootstrap.min.js"></script>
<script src="__api__/js/jquery-weui.min.js"></script>
<script src="__api__/js/toucher.js"></script>
<!--<script src="js/zoom.js"></script>-->
<script src="__api__/js/khData.js"></script>
<script src="__api__/js/touchslider.js"></script>
<script src="__api__/js/navSlider.js"></script>
<script src="__api__/js/more.js"></script>
<script src="__assets__/layui.js"></script>
<script>
    var myTouch = util.toucher(document.getElementById('carousel-example-generic'));
    myTouch.on('swipeLeft',function(e){
        $('#carright').click();
    }).on('swipeRight',function(e){
        $('#carleft').click();
    });
    // 点赞
     $(function(){
    	 var layer;
    	 layui.use('layer', function(){
    		   layer = layui.layer;
    		  
    		  //layer.msg('hello');
    		}); 
        $("#praise").click(function(){
        
        	var url="{:url('api/Favorite/add')}";
        	var place_id=$('#gym').val();
        	var data={place_id:place_id};
            var praise_img = $("#praise-img");
            var can_url="{:url('api/Favorite/delete')}";
//一样这里是进行一般来说流程是这样的我们后台查询数据库 有无收藏 再进行图片的src即可 然后这里一样的 点击事件
//因为用户没有登录也可以进行 查看附近的场馆 当点击收藏的时候需要用户进行登录 否则这个是不可以进行收藏的默认为 未收藏的状态
//所以点击收藏 就可以发送get请求给我的收藏进行处理 我的收藏是必须用户进行如果发现用户没有登录登录即可
//这里需要做的就是一个是用户无状态的时候 如果seesion中没有用户信息 意味着Null
//就是显示 如果不为空 有收藏了说明用户已登录的状态 
            if(praise_img.attr("src") == ("__api__/images/yizan.png")){
            	//取消收藏
            	
                $(this).html("<img src='__api__/images/zan.png' id='praise-img' class='animation' />");
                $.get(can_url,data,function(res){
            		var obj=eval('('+res+')');
            		//console.log(obj);
            		var status=obj.status;
            		var info =obj.info;
            		if(status==1){
            			layer.msg('取消收藏成功',{icon:6});
            		}else if(status==300){
            			layer.msg(info,{icon:5},function(){
            				window.location.href=obj.data;
            			});
            		}else{
            			layer.msg('取消收失败',{icon:5});
            		}
            	})
            }else{
            	//点击收藏
            	
                $(this).html("<img src='__api__/images/yizan.png' id='praise-img' class='animation' />");
                $.get(url,data,function(res){
                	console.log(res);
            		var obj=eval('('+res+')');
            		var status=obj.status;
            		var info =obj.info;
            		if(status==1){
            			layer.msg('收藏成功',{icon:6});
            		}else if(status==300){
                			layer.msg(info,{icon:5},function(){
                				window.location.href=obj.data;
                			});
            		}else{
            			layer.msg('收藏失败',{icon:5});
            		}
            	})
            }
        });
    })
</script>
	</body>
</html>
